package com.kang.dao.impl;

import com.kang.dao.User_typeDao;
import com.kang.util.BaseDao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by 12904 on 2018/8/6.
 */
public class User_typeDaoImpl implements User_typeDao
{
    @Override
    public int find()
    {
        int i = 0;
        Connection conn = null;
        PreparedStatement stat = null;
        ResultSet rs = null;
        String sql = "select utid from user_type where utname = ?";
        conn = BaseDao.getConnection();
        try {
            stat = conn.prepareStatement(sql);
            stat.setString(1,"代理");
            rs = stat.executeQuery();
            while (rs.next()){
                i = rs.getInt(1);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            BaseDao.closeConnection(conn,stat,rs);
        }

        return i;

    }
}
